# Maintainer: Andreas Kemnade <andreas@kemnade.info>
# Kernel config based on: arch/arm/configs/embt2_defconfig

pkgname=linux-epson-embt2ws
pkgver=6.11.0
pkgrel=0
pkgdesc="Epson Moverio BT-200 kernel fork, close to mainline"
arch="armv7"
_carch="arm"
_flavor="epson-embt2ws"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native pmb:kconfigcheck-nftables"
makedepends="
	bash
	bc
	bison
	devicepkg-dev
	findutils
	flex
	gmp-dev
	lzop
	mpc1-dev
	mpfr-dev
	openssl-dev
	perl
"

# Source
_repository="linux"
_commit="261b5c91978435326106a2e03ec2da0b8ae4a35f"
_config="config-$_flavor.$arch"
source="
	$pkgname-$_commit.tar.gz::https://github.com/akemnade/$_repository/archive/$_commit.tar.gz
	$_config
"
builddir="$srcdir/$_repository-$_commit"
_outdir="out"

prepare() {
	REPLACE_GCCH=0
	default_prepare
	. downstreamkernel_prepare
}

build() {
	unset LDFLAGS
	make O="$_outdir" ARCH="$_carch" CC="${CC:-gcc}" \
		KBUILD_BUILD_VERSION="$(( pkgrel + 1 ))-postmarketOS"
}

package() {
	downstreamkernel_package "$builddir" "$pkgdir" "$_carch" "$_flavor" "$_outdir"
	make modules_install dtbs_install \
		O="$_outdir" ARCH="$_carch" \
		INSTALL_MOD_PATH="$pkgdir" \
		INSTALL_DTBS_PATH="$pkgdir/boot/dtbs"
}

sha512sums="
3b852fa6c2145432af339aa16c16078cc9c655f40e072e16f64ac03368b0d28e47b2971408ba3097225d4eea609b557fbdf8f207be0df572fbe6bd62c2529f56  linux-epson-embt2ws-261b5c91978435326106a2e03ec2da0b8ae4a35f.tar.gz
58a36a92242add1f6b00ac99034013b8cb8f9ae4c2ffd2805882dd1e79b91cd276555c2ddfebdcffaa604a3516859ba7780761e6f89abf4341dfb1e0a33b80dd  config-epson-embt2ws.armv7
"
